import time
import sys

import stomp


class MyListener(stomp.ConnectionListener):
    def on_error(self, frame):
        print('received an error "%s"' % frame.body)

    def on_message(self, frame):
        print('received a message "%s"' % frame.body)


conn = stomp.Connection([('192.168.120.221', 61613)])
conn.set_listener('', MyListener())
conn.connect('admin', 'admin', wait=True)
conn.subscribe(destination='/queue/SYSTEM_MASTER_OUT', id=1, ack='auto')

while True:
    time.sleep(5)
